import {GET_SHOP_INFO, CHANGE_SHOP_INFO, GET_AUTH_INFO, CHANGE_AUTH_INFO} from './constants';

const initState = {
    shopName: '',
    address: '',
    phone: '',
    shoplogo: '',
    shopBackgroundImg: '',
    lng: '',
    lat: '',
    notice: '',
    otherInfo: '',
    brandSet: false,
    cityCode: '',
    cityName: '',
    ownerLogo: '',//用户头像
    ownerName: '',//用户昵称
    shopId: '',
    authName: '',
    ownerCardNumber: '',
    cardFront: '',
    cardBackground: '',
    cardWithOwner: '',
    businessLicence: '',
    auditStatus: -1,
    auditPhone: ''
};

const reducer = (state = initState, action) => {
    switch (action.type) {
        case GET_SHOP_INFO:
            return Object.assign({}, state, action.payload);
        case CHANGE_SHOP_INFO:
            return Object.assign({}, state, action.payload);
        case GET_AUTH_INFO:
            return Object.assign({}, state, action.payload);
        case CHANGE_AUTH_INFO:
            return Object.assign({}, state, action.payload);
        default:
            return state;
    }
};

export default reducer;
